
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define ull unsigned long long
#define scf(n) scanf("%d", &n)
#define scfl(n) scanf("%lld", &n)
#define prf(n) printf("%d", n)
#define prfl(n) printf("%lld", n)
#define scfd(n) scanf("%lf", &n)
#define prfd(n) printf("%.lf", n)
#define prf10(n) printf("%.10f", n)
#define ls (rt << 1)
#define rs (rt << 1 | 1)
#define mid (l + r) / 2
#define mms(x, y) memset(x, y, sizeof x)
#define over(i, s, t) for (register long long i = s; i <= t; ++i)
#define lver(i, t, s) for (register long long i = t; i >= s; --i)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const double Pi = 3.1415926535897;
inline double max(double a, double b) { return a > b ? a : b; }
inline double min(double a, double b) { return a < b ? a : b; }
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
int xd[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int yd[8] = {1, 0, -1, 0, -1, 1, -1, 1};

// fastPow
int fastPow(int x, int n) {
  if (n == 1) return x;
  int tmp = fastPow(x, n / 2);  // fenzi
  if (n % 2 == 1)
    return tmp * tmp * x;
  else
    return tmp * tmp;
}

const int MAX = 1e3 + 5;
int N, S, P, T;
double dt;
double u, v, a, b, c, d;
int rn, rns;
int maxd;
double maxv = -INF, minv = INF;
int maxtime = -INF, mintime = INF;
int r[MAX];
vector<int> G[MAX << 1];  //用vector容器存放节点连接情况
struct ce {
  double u, v, a, b, c, d;
  int time;  //神经元发射脉冲的次数
} ces[MAX];
struct mc {
  int s, t;
  double w;
  int D;
} mcs[MAX];

//
static unsigned long next1 = 1;

/* RAND_MAX assumed to be 32767 */
int myrand(void) {
  next1 = next1 * 1103515245 + 12345;
  return ((unsigned)(next1 / 65536) % 32768);
}
//

int main() {
  rns = 0;
  cin >> N >> S >> P >> T;
  cin >> dt;
  while (rns < N) {
    cin >> rn >> v >> u >> a >> b >> c >> d;
    //        over(i,rns,rns+rn-1)
    //更新的是每段时间的神经元信息
    for (int i = rns; i < rns + rn; i++) {
      ces[i].v = v;
      ces[i].u = u;
      ces[i].a = a;
      ces[i].b = b;
      ces[i].c = c;
      ces[i].d = d;
      ces[i].time = 0;
    }
    rns += rn;  //为了满足rn之和=rns
  }
  //    over(i,0,P-1)
  for (int i = 0; i < P; i++) cin >> r[i];
  //    over(i,0,S-1)
  for (int i = 0; i < S; i++) {
    cin >> mcs[i].s >> mcs[i].t >> mcs[i].w >> mcs[i].D;
    maxd = max(maxd, mcs[i].D);
    G[mcs[i].s].push_back(i);  //存放节点连接情况
  }
  int mod = maxd + 1;
  vector<vector<double>> I(mod, vector<double>(N));
  //    over(k,0,T-1)
  for (int k = 0; k < T; k++) {
    // Ik表示每时刻受到的脉冲之和 所以每次都要清零
    //        over(i,0,N-1)
    for (int i = 0; i < N; i++) I[(k + maxd) % mod][i] = 0;

    //脉冲过程的模拟
    //        over(i,0,P-1)
    for (int i = 0; i < P; i++) {
      int my = myrand();
      if (r[i] > my) {
        //                over(j,0,G[N+i].size()-1)
        for (int j = 0; j < G[N + i].size(); j++)  //传向连接的所有神经元
        {
          mc m = mcs[G[N + i][j]];
          I[(k + m.D) % mod][m.t] += m.w;
        }
      }
    }

    //
    //        over(i,0,N-1)
    for (int i = 0; i < N; i++) {
      double v1 = ces[i].v;
      double u1 = ces[i].u;
      double a1 = ces[i].a;
      double b1 = ces[i].b;
      ces[i].v = v1 + dt * (0.04 * v1 * v1 + 5 * v1 + 140 - u1) + I[k % mod][i];
      ces[i].u = u1 + dt * a1 * (b1 * v1 - u1);
      if (ces[i].v >= 30) {
        ces[i].time++;
        for (int j = 0; j < G[i].size(); j++)
        //                over(j,0,G[i].size()-1)
        {
          mc m = mcs[G[i][j]];
          I[(k + m.D) % mod][m.t] += m.w;
        }
        ces[i].v = ces[i].c;
        ces[i].u += ces[i].d;
      }
    }
  }
  //    over(i,0,N-1)
  for (int i = 0; i < N; i++) {
    maxv = max(maxv, ces[i].v);
    minv = min(minv, ces[i].v);
    maxtime = max(maxtime, ces[i].time);
    mintime = min(mintime, ces[i].time);
  }
  cout << fixed << setprecision(3) << minv << " " << maxv << endl;
  cout << mintime << " " << maxtime << endl;
  return 0;
}
